package com.chenhs.oop.study.线程;

import java.util.concurrent.Callable;

/**
 * @className: com.chenhs.oop.study.线程-> ThreadImp
 * @description: 利用Callable接口和FutureTask类方式 实现多线程
 * @author: chenhs
 * @createDate: 2024-03-09 16:45
 * @version: 1.0
 */
public class My03Thread implements Callable<Integer> {
    private Integer a;
    private Integer count;

    public My03Thread(Integer a, Integer count) {
        this.a = a;
        this.count = count;
    }

    @Override
    public Integer call() throws Exception {
//        线程需要执行代码
        for (int i = 0; i < count; i++) {
            a++;
            System.out.println(a);
        }
        return a ;
    }
}
